#pragma once

#include <typedef.h>
//
#include <protocol.hpp>
#include <semaphore.hpp>
#include <task_run.hpp>

class TcpClient : TaskRun
{
public:
	TcpClient();
	virtual ~TcpClient();
	static TcpClient* Instance(void);
	virtual void Start(void* arg = nullptr);
	void Send(uint16_t dataType, char* data, int size);

protected:
	virtual void Run(void* arg);

private:
	std::string m_Ip;
	int m_Port;

	Protocol m_Protocol;
	BuffFifo m_BuffFifo;

	char* m_BuffSend;
	char* m_BuffRecv;

	int m_SocketId;
	int m_SizeSend;
	int m_SizeRecv;
	uint16_t m_DataSeqRecv;
	uint16_t m_DataTypeRecv;
	uint16_t m_DataSeqSend;
	uint16_t m_DataTypeSend;
};
